package com.yenlien.traceyun.plant.dao;

import com.yenlien.traceyun.plant.entity.FarmInputs;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface FarmInputsDao extends BaseJpaDao<FarmInputs> {

    List<FarmInputs> findByFarmId(String farmId);


    @Deprecated
    @Query(value = "SELECT tp.batch, tpfi.* FROM t_plant_farm_inputs tpfi JOIN t_plant_farm tpf ON tpfi.farm_id = tpf.id JOIN t_plant tp ON tpf.plant_id = tp.id WHERE tpfi.inputs_id IN (?1)", nativeQuery = true)
    List<FarmInputs> getBatch(List<String> inputIds);
}
